#pragma once
#ifndef H_Ray
#define H_Ray

#include <iostream>

#include "Color.h"
#include "Vector3.h"
#include "Intersection.h"
#include "Object.h"
#include "Scene.h"
#include "Light.h"
#include "DebugWriter.h"
#include "Globals.h"

using namespace std;

const int MAX_DEPTH = 1;

class Ray {
	public:
		Ray(void);
		Ray(Vector3 p, Vector3 d, Scene s);
		
		~Ray(void);
		
		Color trace(void);
		Intersection intersect(Vector3 p, Vector3 d, bool lightCheck);
		Vector3 normal(Vector3 p, Object *object);
		Vector3 reflect(Vector3 d, Vector3 n);
		Vector3 transmit(Vector3 q, Vector3 n);
		Color phong(Vector3 p, Vector3 q, Vector3 n, Vector3 r, Object *object);
		
		Vector3 origin;
		Vector3 direction;
		Color cBackground, cLight;
		
		Scene scene;

		//Vector3 inv_direction;
		//int sign[3];
		
	private:
		Color trace(Vector3 p, Vector3 d, int depth);
		float closestT;
};
#endif